package com.ch.workmanagerdemo

import android.content.Context
import android.os.SystemClock
import android.util.Log
import androidx.work.Data
import androidx.work.Worker
import androidx.work.WorkerParameters

class MyWork(context: Context, workerParams: WorkerParameters) : Worker(context, workerParams) {
    override fun doWork(): Result {
       val inputData= inputData.getString("data")
        SystemClock.sleep(5000)
        val data = Data.Builder()
            .putString("data","Hogan,执行成功")
            .build()
        Log.e("Hogan", "这是一个Worker  $inputData")
        return Result.success(data)
    }
}